<?php

namespace UFSW\UsuarioBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class UsuarioType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('apellido')
            ->add('email','email')
            ->add('identificador', 'choice', array(
                'choices'   => array(
                    '1'   => 'd.n.i',
                    '2' => 'pasaporte',
                    '3'   => 'c.i',
                    ),
                'empty_value' => 'seleccione',
                ))
            ->add('idioma')
            ->add('fecNac','date', array(
                'label' => 'fecha.automatica',
    		'data' => new \DateTime()))
            ->add('nombre')
            ->add('numIdentificador','text')
            ->add('password','password')
            ->add('username')
            ->add('nacionalidad')
            ->add('paisResidencia')
            ->add('paisIdentificador')
            ->add('provincia')
            ->add('ciudad')
        ;
    }
    
    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'UFSW\DataBaseBundle\Entity\Usuario'
        ));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'ufsw_usuario';
    }
}
